﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BLL;

namespace IPR_TrainExamSys_TY.SysSet
{
    public partial class FrmDepartMent : Form
    {
        Model.T_PublicEmployee mSelEmployee = new Model.T_PublicEmployee();
        DataTable dtSelTable = new DataTable();
        long lFID = 0;
        public FrmDepartMent()
        {
            InitializeComponent();
        }


        private void FrmDepartMent_Load(object sender, EventArgs e)
        {

        }

        private void getLocomotive()
        {
            string sql = " SELECT distinct LocomotiveNoId,LocomotiveName FROM T_PublicDepartment ";
            DataSet ds = new T_Public().Query(sql);
            if(ds!=null)
                if(ds.Tables.Count>0)
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        cmbLocomotiveNameSearch.DataSource = ds.Tables[0];
                        cmbLocomotiveNameSearch.ValueMember = "LocomotiveNoId";
                        cmbLocomotiveNameSearch.DisplayMember = "LocomotiveName";

                    }
            DataSet ds1 = ds.Copy();
            if (ds1 != null)
                if (ds1.Tables.Count > 0)
                    if (ds1.Tables[0].Rows.Count > 0)
                    {
                        cmbLocomotiveName.DataSource = ds1.Tables[0];
                        cmbLocomotiveName.ValueMember = "LocomotiveNoId";
                        cmbLocomotiveName.DisplayMember = "LocomotiveName";
                    }

        }

        private void getDepartment()
        {
            string sql = " SELECT distinct DepartmentId,DepartmentName FROM T_PublicDepartment ";
            DataSet ds = new T_Public().Query(sql);
            if (ds != null)
                if (ds.Tables.Count > 0)
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        cmbDepartmentName.DataSource = ds.Tables[0];
                        cmbDepartmentName.ValueMember = "DepartmentId";
                        cmbDepartmentName.DisplayMember = "DepartmentName";
                    }
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            string sWhere = " 1=1 ";
            if (cmbLocomotiveNameSearch.SelectedValue != null)
                sWhere += " and LocomotiveNoId=" + cmbLocomotiveNameSearch.SelectedValue.ToString();
            if (cmbDepartmentNameSearch.SelectedValue != null)
                sWhere += " and DepartmentId =" + cmbDepartmentNameSearch.SelectedValue.ToString();
            if (cmbClassGroupNameSearch.SelectedValue != null)
                sWhere += " and ClassGroupId =" + cmbClassGroupNameSearch.SelectedValue.ToString();
            DataSet ds = new T_PublicDepartment().GetList(sWhere);
            if (ds != null)
                if (ds.Tables.Count > 0)
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        superGridControl1.PrimaryGrid.DataSource = ds.Tables[0]; 
                        Cursor.Current = Cursors.Default; ;
                    }
            Cursor.Current = Cursors.Default; ;
        }

        private void btnPreview_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Filter = "(*.xls)|*.xls|(*.xlsx)|*.xlsx";
            openFileDialog1.Title = "选择要导入的模板";
            openFileDialog1.Multiselect = false;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                tbFileName.Text = openFileDialog1.FileName;
            }
        }

        private void btnImport_Click(object sender, EventArgs e)
        {

            if (tbFileName.Text == "") return;
            string msg = "";
            progressBarX1.Visible = true;
            if (Import(tbFileName.Text, new DataTable(), "", ref msg))
            {
                System.Windows.Forms.MessageBox.Show(msg, "导入成功");
                tbFileName.Text = "";
                btnSearch_Click(sender, e);
            }
            else System.Windows.Forms.MessageBox.Show(msg, "导入失败");
            progressBarX1.Visible = false;
        }

        #region Import()
        /// <summary>
        /// 批量导入
        /// </summary>
        /// <param name="factPath">文件路径</param>
        /// <param name="dt">DataTable对象</param>
        /// <returns>bool</returns>
        protected bool Import(string factPath, DataTable dt, string fileName, ref string msg)
        {
            string sMsg = "";
            if (Common.NPOIHelper.GetExcel(factPath, ref dt, fileName))
            {
                //dt.Rows.RemoveAt(0);
                #region 导入员工信息模板
                if (dt.Rows.Count > 0)
                {
                    try
                    {
                        #region 导入子表
                        progressBarX1.Maximum = dt.Rows.Count;
                        progressBarX1.Minimum = 0;
                        progressBarX1.Value = 0;
                        string sfirsthj = "";
                        string sXM = "";
                        string sss = "";
                        for (int i = 1; i < dt.Rows.Count; i++)
                        {
                            progressBarX1.Value = i;
                            Application.DoEvents();

                            if ((dt.Rows[i][1].ToString() == "") && (dt.Rows[i][0].ToString() == "") && (dt.Rows[i][2].ToString() == "") && (dt.Rows[i][3].ToString() == ""))
                                continue;
                            Model.T_PublicEmployee mEmployee = RowToPublicEmployee(dt.Rows[i]);

                            bool bExist = false;
                            string sWhere = " EmployeeId='" + mEmployee.EmployeeId + "' and GWHGZSBH='" + mEmployee.GWHGZSBH + "' ";
                            DataSet ds = new T_PublicEmployee().GetList(sWhere);
                            if (ds != null)
                                if (ds.Tables.Count > 0)
                                    if (ds.Tables[0].Rows.Count > 0)
                                    {
                                        sMsg += "工号" + mEmployee.EmployeeId + " 或者 岗位合格证书编号 " + mEmployee.GWHGZSBH + "重复!\r\n";
                                        bExist = true;
                                    }
                            if (!bExist)
                            {
                                new T_PublicEmployee().Add(mEmployee);
                            }
                        }
                        msg = "导入完成\r\n" + sMsg;
                        return true;
                        #endregion

                    }
                    catch (Exception exc)
                    {
                        msg = exc.Message;
                        return false;
                    }
                }
                else
                {
                    msg = "数据格式有误，请检查！";
                    return false;
                }
                #endregion
            }
            else
            {
                msg = "导入数据格式有误，请检查！";
                return false;
            }
        }

        private Model.T_PublicEmployee RowToPublicEmployee(DataRow myRow)
        {

            Model.T_PublicEmployee mEmployee = new Model.T_PublicEmployee();
            #region 获取，会出错
            //mEmployee.EmployeeId = myRow["工号"].ToString();
            //mEmployee.EmployeeName = myRow["姓名"].ToString();
            //mEmployee.Sex = myRow["性别"].ToString();
            //mEmployee.Birthday = myRow["出生日期"].ToString();
            //mEmployee.Nation = myRow["民族"].ToString();
            //mEmployee.Native = myRow["籍贯"].ToString();
            //mEmployee.PoliticalStatus = myRow["政治面目"].ToString();
            //mEmployee.LicenceDate1 = myRow["党团时间"].ToString();
            //mEmployee.LicenceDate2 = myRow["工作时间"].ToString();
            //mEmployee.EntryTime = myRow["入路时间"].ToString();
            //mEmployee.Certificate = myRow["本单位日期"].ToString();
            //mEmployee.Job = myRow["职务"].ToString();
            //mEmployee.CertificateType = myRow["任职时间"].ToString();
            //mEmployee.JZ = myRow["兼职"].ToString();
            //mEmployee.JB = myRow["级别"].ToString();
            //mEmployee.ZGSJ = myRow["转干时间"].ToString();
            //mEmployee.TechnicalTitle = myRow["技术职务"].ToString();
            //mEmployee.RJSJ = myRow["任技时间"].ToString();
            //mEmployee.GZFL = myRow["工种分类"].ToString();
            //mEmployee.IsClassLeader = myRow["任班组长"].ToString();
            //mEmployee.HTGW = myRow["合同岗位"].ToString();
            //mEmployee.SYYZ = myRow["三员一长"].ToString();
            //mEmployee.RYLY = myRow["人员来源"].ToString();
            //mEmployee.RYFL = myRow["人员分类"].ToString();
            //mEmployee.Education = myRow["文化程度"].ToString();
            //mEmployee.BYSJ = myRow["毕业时间"].ToString();
            //mEmployee.BYXX = myRow["毕业学校"].ToString();
            //mEmployee.XXLB = myRow["学校类别"].ToString();
            //mEmployee.SXZY = myRow["所学专业"].ToString();
            //mEmployee.XZHC = myRow["现在何处"].ToString();
            //mEmployee.YGXS = myRow["用工形式"].ToString();
            //mEmployee.HTQX = myRow["合同期限"].ToString();
            //mEmployee.QDSJ = myRow["签订时间"].ToString();
            //mEmployee.DAGZ = myRow["档案工资"].ToString();
            //mEmployee.JNGZ = myRow["技能工资"].ToString();
            //mEmployee.GWGZ = myRow["岗位工资"].ToString();
            //mEmployee.GLGZ = myRow["工龄工资"].ToString();
            //mEmployee.JNJD = myRow["技能鉴定"].ToString();
            //mEmployee.DY = myRow["待遇"].ToString();
            //mEmployee.GWDX = myRow["岗位档序"].ToString();
            //mEmployee.JNDX = myRow["技能档序"].ToString();
            //mEmployee.XGW = myRow["现岗位"].ToString();
            //mEmployee.XGSJ = myRow["现岗时间"].ToString();
            //mEmployee.TXTJ = myRow["退休条件"].ToString();
            //mEmployee.HZ = myRow["婚况"].ToString();
            //mEmployee.FJQK = myRow["分居情况"].ToString();												

            //mEmployee.XSTQ = myRow["享受探亲"].ToString();
            //mEmployee.HKSZD = myRow["户口所在"].ToString();
            //mEmployee.JTZZ = myRow["家庭住址"].ToString();
            //mEmployee.BZ = myRow["备注"].ToString();
            //mEmployee.SFZH = myRow["身份证号"].ToString();
            //mEmployee.GZZH = myRow["工作证号"].ToString();
            //mEmployee.HYDM = myRow["行业代码"].ToString();
            //mEmployee.SCZ = myRow["生产组"].ToString();
            //mEmployee.GZXM = myRow["工资项目"].ToString();
            //mEmployee.QTGZ = myRow["其他工资"].ToString();
            //mEmployee.BYSJ1 = myRow["备用数据"].ToString();
            //mEmployee.LocomotiveNo = myRow["单位名称"].ToString();
            //mEmployee.GRJD = myRow["工人鉴定"].ToString();
            //mEmployee.LTRQ = myRow["离退日期"].ToString();
            //mEmployee.GLZD = myRow["工龄中断"].ToString();
            //mEmployee.HTZZ = myRow["合同终止"].ToString();
            //mEmployee.LWQS = myRow["劳务起始"].ToString();
            //mEmployee.LWZZ = myRow["劳务终止"].ToString();
            //mEmployee.NL = myRow["年龄"].ToString();
            //mEmployee.GZSJ = myRow["工种时间"].ToString();
            //mEmployee.SYQ = myRow["试用期"].ToString();
            //mEmployee.JCRQ = myRow["解除日期"].ToString();
            //mEmployee.JCYY = myRow["解除原因"].ToString();
            //mEmployee.SHBZ = myRow["生活补助金"].ToString();			
            //mEmployee.JJBC = myRow["经济补偿金"].ToString();
            //mEmployee.YLBZ = myRow["医疗补助金"].ToString();
            //mEmployee.HTBH = myRow["合同编号"].ToString();
            //mEmployee.ZH = myRow["证号"].ToString();
            //mEmployee.YGFL = myRow["用工分类"].ToString();
            //mEmployee.HTQ = myRow["合同起"].ToString();
            //mEmployee.HTZ = myRow["合同止"].ToString();
            //mEmployee.DQ = myRow["到期"].ToString();
            //mEmployee.GWHGZSBH = myRow["岗位合格证号"].ToString();

            #endregion

            mEmployee.EmployeeId = myRow[1].ToString();
            mEmployee.EmployeeName = myRow[0].ToString();
            mEmployee.WorkShop = myRow[2].ToString();
            mEmployee.ClassGroup = myRow[3].ToString();
            mEmployee.Sex = myRow[4].ToString();

            mEmployee.Birthday = myRow[5].ToString();
            mEmployee.Nation = myRow[6].ToString();
            mEmployee.Native = myRow[7].ToString();
            mEmployee.PoliticalStatus = myRow[8].ToString();
            mEmployee.LicenceDate1 = myRow[9].ToString();
            mEmployee.LicenceDate2 = myRow[10].ToString();
            mEmployee.EntryTime = myRow[11].ToString();
            mEmployee.Certificate = myRow[12].ToString();
            mEmployee.Job = myRow[13].ToString();
            mEmployee.CertificateType = myRow[14].ToString();
            mEmployee.JZ = myRow[15].ToString();
            mEmployee.JB = myRow[16].ToString();
            mEmployee.ZGSJ = myRow[17].ToString();
            mEmployee.TechnicalTitle = myRow[18].ToString();
            mEmployee.RJSJ = myRow[19].ToString();
            mEmployee.GZFL = myRow[20].ToString();
            mEmployee.IsClassLeader = myRow[21].ToString();
            mEmployee.HTGW = myRow[22].ToString();
            mEmployee.SYYZ = myRow[23].ToString();
            mEmployee.RYLY = myRow[24].ToString();
            mEmployee.RYFL = myRow[25].ToString();
            mEmployee.Education = myRow[26].ToString();
            mEmployee.BYSJ = myRow[27].ToString();
            mEmployee.BYXX = myRow[28].ToString();
            mEmployee.XXLB = myRow[29].ToString();
            mEmployee.SXZY = myRow[30].ToString();
            mEmployee.XZHC = myRow[31].ToString();
            mEmployee.YGXS = myRow[32].ToString();
            mEmployee.HTQX = myRow[33].ToString();
            mEmployee.QDSJ = myRow[34].ToString();
            mEmployee.DAGZ = myRow[35].ToString();
            mEmployee.JNGZ = myRow[36].ToString();
            mEmployee.GWGZ = myRow[37].ToString();
            mEmployee.GLGZ = myRow[38].ToString();
            mEmployee.JNJD = myRow[39].ToString();
            mEmployee.DY = myRow[40].ToString();
            mEmployee.GWDX = myRow[41].ToString();
            mEmployee.JNDX = myRow[42].ToString();
            mEmployee.XGW = myRow[43].ToString();
            mEmployee.XGSJ = myRow[44].ToString();
            mEmployee.TXTJ = myRow[45].ToString();
            mEmployee.HZ = myRow[46].ToString();
            mEmployee.FJQK = myRow[47].ToString();

            mEmployee.XSTQ = myRow[48].ToString();
            mEmployee.HKSZD = myRow[49].ToString();
            mEmployee.JTZZ = myRow[50].ToString();
            mEmployee.BZ = myRow[51].ToString();
            mEmployee.SFZH = myRow[52].ToString();
            mEmployee.GZZH = myRow[53].ToString();
            mEmployee.HYDM = myRow[54].ToString();
            mEmployee.SCZ = myRow[55].ToString();
            mEmployee.GZXM = myRow[56].ToString();
            mEmployee.QTGZ = myRow[57].ToString();
            mEmployee.BYSJ1 = myRow[58].ToString();
            mEmployee.LocomotiveNo = myRow[61].ToString();
            mEmployee.GRJD = myRow[64].ToString();
            mEmployee.LTRQ = myRow[65].ToString();
            mEmployee.GLZD = myRow[66].ToString();
            mEmployee.HTZZ = myRow[67].ToString();
            mEmployee.LWQS = myRow[68].ToString();
            mEmployee.LWZZ = myRow[69].ToString();
            mEmployee.NL = myRow[70].ToString();
            mEmployee.GZSJ = myRow[71].ToString();
            mEmployee.SYQ = myRow[72].ToString();
            mEmployee.JCRQ = myRow[73].ToString();
            mEmployee.JCYY = myRow[74].ToString();
            mEmployee.SHBZ = myRow[75].ToString();
            mEmployee.JJBC = myRow[76].ToString();
            mEmployee.YLBZ = myRow[77].ToString();
            mEmployee.HTBH = myRow[78].ToString();
            mEmployee.ZH = myRow[79].ToString();
            mEmployee.YGFL = myRow[80].ToString();
            mEmployee.HTQ = myRow[81].ToString();
            mEmployee.HTZ = myRow[82].ToString();
            mEmployee.DQ = myRow[83].ToString();
            mEmployee.GWHGZSBH = myRow[84].ToString();
            return mEmployee;
        }
        #endregion

        private void btnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void superGridControl1_CellClick(object sender, DevComponents.DotNetBar.SuperGrid.GridCellClickEventArgs e)
        {
            try
            {
                dtSelTable = new DataTable();
                for (int i = 0; i < superGridControl1.PrimaryGrid.Columns.Count; i++)
                {
                    dtSelTable.Columns.Add(superGridControl1.PrimaryGrid.Columns[i].DataPropertyName.ToString());
                }
                DataRow dNewRow = dtSelTable.NewRow();
                for (int i = 0; i < superGridControl1.PrimaryGrid.Columns.Count; i++)
                {
                    dNewRow[i] = e.GridPanel.GetCell(e.GridCell.RowIndex, i).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, i).Value.ToString();
                }
                dtSelTable.Rows.Add(dNewRow);
                Model.T_PublicEmployee mEmployee = new Model.T_PublicEmployee();
                mEmployee.EmployeeId = e.GridPanel.GetCell(e.GridCell.RowIndex, 1).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 1).Value.ToString();
                mEmployee.EmployeeName = e.GridPanel.GetCell(e.GridCell.RowIndex, 0).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 0).Value.ToString();
                mEmployee.LocomotiveNo = e.GridPanel.GetCell(e.GridCell.RowIndex, 2).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 2).Value.ToString();
                mEmployee.WorkShop = e.GridPanel.GetCell(e.GridCell.RowIndex, 3).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 3).Value.ToString();
                mEmployee.ClassGroup = e.GridPanel.GetCell(e.GridCell.RowIndex, 4).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 4).Value.ToString();
                mEmployee.Sex = e.GridPanel.GetCell(e.GridCell.RowIndex, 5).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 5).Value.ToString();
                mEmployee.Birthday = e.GridPanel.GetCell(e.GridCell.RowIndex, 6).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 6).Value.ToString();
                mEmployee.Nation = e.GridPanel.GetCell(e.GridCell.RowIndex, 7).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 7).Value.ToString();
                mEmployee.Native = e.GridPanel.GetCell(e.GridCell.RowIndex, 8).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 8).Value.ToString();
                mEmployee.PoliticalStatus = e.GridPanel.GetCell(e.GridCell.RowIndex, 9).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 9).Value.ToString();
                mEmployee.LicenceDate1 = e.GridPanel.GetCell(e.GridCell.RowIndex, 10).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 10).Value.ToString();
                mEmployee.LicenceDate2 = e.GridPanel.GetCell(e.GridCell.RowIndex, 11).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 11).Value.ToString();
                mEmployee.EntryTime = e.GridPanel.GetCell(e.GridCell.RowIndex, 12).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 12).Value.ToString();
                mEmployee.Certificate = e.GridPanel.GetCell(e.GridCell.RowIndex, 13).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 13).Value.ToString();
                mEmployee.Job = e.GridPanel.GetCell(e.GridCell.RowIndex, 14).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 14).Value.ToString();
                mEmployee.CertificateType = e.GridPanel.GetCell(e.GridCell.RowIndex, 15).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 15).Value.ToString();
                mEmployee.JZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 16).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 16).Value.ToString();
                mEmployee.JB = e.GridPanel.GetCell(e.GridCell.RowIndex, 17).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 17).Value.ToString();
                mEmployee.ZGSJ = e.GridPanel.GetCell(e.GridCell.RowIndex, 18).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 18).Value.ToString();
                mEmployee.TechnicalTitle = e.GridPanel.GetCell(e.GridCell.RowIndex, 19).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 19).Value.ToString();
                mEmployee.RJSJ = e.GridPanel.GetCell(e.GridCell.RowIndex, 20).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 20).Value.ToString();
                mEmployee.GZFL = e.GridPanel.GetCell(e.GridCell.RowIndex, 21).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 21).Value.ToString();
                mEmployee.IsClassLeader = e.GridPanel.GetCell(e.GridCell.RowIndex, 22).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 22).Value.ToString();
                mEmployee.HTGW = e.GridPanel.GetCell(e.GridCell.RowIndex, 23).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 23).Value.ToString();
                mEmployee.SYYZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 24).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 24).Value.ToString();
                mEmployee.RYLY = e.GridPanel.GetCell(e.GridCell.RowIndex, 25).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 25).Value.ToString();
                mEmployee.RYFL = e.GridPanel.GetCell(e.GridCell.RowIndex, 26).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 26).Value.ToString();
                mEmployee.Education = e.GridPanel.GetCell(e.GridCell.RowIndex, 27).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 27).Value.ToString();
                mEmployee.BYSJ = e.GridPanel.GetCell(e.GridCell.RowIndex, 28).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 28).Value.ToString();
                mEmployee.BYXX = e.GridPanel.GetCell(e.GridCell.RowIndex, 29).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 29).Value.ToString();
                mEmployee.XXLB = e.GridPanel.GetCell(e.GridCell.RowIndex, 30).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 30).Value.ToString();
                mEmployee.SXZY = e.GridPanel.GetCell(e.GridCell.RowIndex, 31).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 31).Value.ToString();
                mEmployee.XZHC = e.GridPanel.GetCell(e.GridCell.RowIndex, 32).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 32).Value.ToString();
                mEmployee.YGXS = e.GridPanel.GetCell(e.GridCell.RowIndex, 33).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 33).Value.ToString();
                mEmployee.HTQX = e.GridPanel.GetCell(e.GridCell.RowIndex, 34).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 34).Value.ToString();
                mEmployee.QDSJ = e.GridPanel.GetCell(e.GridCell.RowIndex, 35).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 35).Value.ToString();
                mEmployee.DAGZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 36).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 36).Value.ToString();
                mEmployee.JNGZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 37).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 37).Value.ToString();
                mEmployee.GWGZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 38).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 38).Value.ToString();
                mEmployee.GLGZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 39).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 39).Value.ToString();
                mEmployee.JNJD = e.GridPanel.GetCell(e.GridCell.RowIndex, 40).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 40).Value.ToString();
                mEmployee.DY = e.GridPanel.GetCell(e.GridCell.RowIndex, 41).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 41).Value.ToString();
                mEmployee.GWDX = e.GridPanel.GetCell(e.GridCell.RowIndex, 42).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 42).Value.ToString();
                mEmployee.JNDX = e.GridPanel.GetCell(e.GridCell.RowIndex, 43).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 43).Value.ToString();
                mEmployee.XGW = e.GridPanel.GetCell(e.GridCell.RowIndex, 44).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 44).Value.ToString();
                mEmployee.XGSJ = e.GridPanel.GetCell(e.GridCell.RowIndex, 45).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 45).Value.ToString();
                mEmployee.TXTJ = e.GridPanel.GetCell(e.GridCell.RowIndex, 46).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 46).Value.ToString();
                mEmployee.HZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 47).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 47).Value.ToString();
                mEmployee.FJQK = e.GridPanel.GetCell(e.GridCell.RowIndex, 48).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 48).Value.ToString();
                mEmployee.XSTQ = e.GridPanel.GetCell(e.GridCell.RowIndex, 49).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 49).Value.ToString();
                mEmployee.HKSZD = e.GridPanel.GetCell(e.GridCell.RowIndex, 50).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 50).Value.ToString();
                mEmployee.JTZZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 51).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 51).Value.ToString();
                mEmployee.BZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 52).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 52).Value.ToString();
                mEmployee.SFZH = e.GridPanel.GetCell(e.GridCell.RowIndex, 53).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 53).Value.ToString();
                mEmployee.GZZH = e.GridPanel.GetCell(e.GridCell.RowIndex, 54).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 54).Value.ToString();
                mEmployee.HYDM = e.GridPanel.GetCell(e.GridCell.RowIndex, 55).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 55).Value.ToString();
                mEmployee.SCZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 56).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 56).Value.ToString();
                mEmployee.GZXM = e.GridPanel.GetCell(e.GridCell.RowIndex, 57).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 57).Value.ToString();
                mEmployee.QTGZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 58).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 58).Value.ToString();
                mEmployee.BYSJ1 = e.GridPanel.GetCell(e.GridCell.RowIndex, 59).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 59).Value.ToString();
                mEmployee.GRJD = e.GridPanel.GetCell(e.GridCell.RowIndex, 60).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 60).Value.ToString();
                mEmployee.LTRQ = e.GridPanel.GetCell(e.GridCell.RowIndex, 61).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 61).Value.ToString();
                mEmployee.GLZD = e.GridPanel.GetCell(e.GridCell.RowIndex, 62).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 62).Value.ToString();
                mEmployee.HTZZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 63).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 63).Value.ToString();
                mEmployee.LWQS = e.GridPanel.GetCell(e.GridCell.RowIndex, 64).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 64).Value.ToString();
                mEmployee.LWZZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 65).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 65).Value.ToString();
                mEmployee.NL = e.GridPanel.GetCell(e.GridCell.RowIndex, 66).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 66).Value.ToString();
                mEmployee.GZSJ = e.GridPanel.GetCell(e.GridCell.RowIndex, 67).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 67).Value.ToString();
                mEmployee.SYQ = e.GridPanel.GetCell(e.GridCell.RowIndex, 68).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 68).Value.ToString();
                mEmployee.JCRQ = e.GridPanel.GetCell(e.GridCell.RowIndex, 69).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 69).Value.ToString();
                mEmployee.JCYY = e.GridPanel.GetCell(e.GridCell.RowIndex, 70).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 70).Value.ToString();
                mEmployee.SHBZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 71).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 71).Value.ToString();
                mEmployee.JJBC = e.GridPanel.GetCell(e.GridCell.RowIndex, 72).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 72).Value.ToString();
                mEmployee.YLBZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 73).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 73).Value.ToString();
                mEmployee.HTBH = e.GridPanel.GetCell(e.GridCell.RowIndex, 74).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 74).Value.ToString();
                mEmployee.ZH = e.GridPanel.GetCell(e.GridCell.RowIndex, 75).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 75).Value.ToString();
                mEmployee.YGFL = e.GridPanel.GetCell(e.GridCell.RowIndex, 76).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 76).Value.ToString();
                mEmployee.HTQ = e.GridPanel.GetCell(e.GridCell.RowIndex, 77).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 77).Value.ToString();
                mEmployee.HTZ = e.GridPanel.GetCell(e.GridCell.RowIndex, 78).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 78).Value.ToString();
                mEmployee.DQ = e.GridPanel.GetCell(e.GridCell.RowIndex, 79).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 79).Value.ToString();
                mEmployee.GWHGZSBH = e.GridPanel.GetCell(e.GridCell.RowIndex, 80).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 80).Value.ToString();
                mEmployee.FID = long.Parse(e.GridPanel.GetCell(e.GridCell.RowIndex, 81).Value.ToString());
                lFID = long.Parse(e.GridPanel.GetCell(e.GridCell.RowIndex, 81).Value.ToString());
                mEmployee.Password = e.GridPanel.GetCell(e.GridCell.RowIndex, 82).Value == null ? "" : e.GridPanel.GetCell(e.GridCell.RowIndex, 82).Value.ToString();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, "错误");
            }
        }

        private void btnAdd_Click(object sender, EventArgs e)
        {
        }

        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (dtSelTable.Rows.Count == 0)
            {
                MessageBox.Show("请选择要修改的行", "选择行");
                return;
            }
            //FrmDepartMentSet fes = new FrmDepartMentSet(dtSelTable, "U");
            //fes.ShowDialog();
            //fes.Close();
        }

        private void btnDel_Click(object sender, EventArgs e)
        {
            if (dtSelTable.Rows.Count == 0)
            {
                MessageBox.Show("请选择要删除的行", "选择行");
                return;
            }
            if (new T_PublicEmployee().Delete(lFID))
            {
                MessageBox.Show("删除成功！", "删除行");
                return;
            }
        }
    }
}
